﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace VmcRemote.Common
{
    [global::System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    public sealed class DefaultConnectionAttribute : Attribute
    {
        // This is a positional argument
        public DefaultConnectionAttribute(Type type)
        {
            this.Type = type;
        }

        public Type Type { get; private set; }

        public static Type GetDefaultConnection(Type type)
        {
            object[] attrs = type.GetCustomAttributes(typeof(DefaultConnectionAttribute), false);
            if (attrs != null && attrs.Length > 0)
                return ((DefaultConnectionAttribute)attrs[0]).Type;
            return null;
        }
    }
}
